package au.org.tern.ecoinformatics.oai.provider.util;

import javax.annotation.PostConstruct;

import mx4j.tools.adaptor.http.HttpAdaptor;

import org.springframework.jmx.export.annotation.ManagedResource;

/**
 * Export + starts the mx4j HTTP adaptor, enabling JMX bean access via HTTP.
 */
@ManagedResource(objectName = "bean:name=au.org.tern.ecoinformatics.oai.provider.util.JmxHttpAdaptor")
public class JmxHttpAdaptor extends HttpAdaptor {
	@PostConstruct
	public void init() {
		new Thread() {
			public void run() {
				try {
					Thread.sleep(10000);
					JmxHttpAdaptor.this.start();
				} catch (Exception e) {
					throw new RuntimeException(e);
				}
			};
		}.start();
	}
}
